package com.work.api.main;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.work.dto.main.TShipBillStatusSearchDTO;
import com.work.entity.main.TShipBillStatus;
import com.work.service.main.ITShipBillStatusService;
import com.work.vo.main.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

/**
 * 舱单理货数控制器
 *
 * @author ：dujianyu
 * @since ：Created in 2024/6/26 11:10
 */
@RestController
@AllArgsConstructor
@RequestMapping("tShipBillStatus")
@Api(value = "舱单理货数控制器", tags = "舱单理货数控制器")
public class TShipBillStatusController extends BladeController {

    private ITShipBillStatusService service;

    @GetMapping("/shipExpBillStatPage")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "出口船统计分页", notes = "传入dto")
    public R<IPage<ExpShipBillStatVO>> shipExpBillStatPage(TShipBillStatusSearchDTO dto, Query query) {
        IPage<ExpShipBillStatVO> page = service.shipExpBillStatPage(Condition.getPage(query), dto);
        return R.data(page);
    }

    @GetMapping("/shipExpBillStatTotal")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "出口船统计合计", notes = "传入dto")
    public R<ExpShipBillStatTotalVO> shipExpBillStatTotal(TShipBillStatusSearchDTO dto) {
        ExpShipBillStatTotalVO data = service.shipExpBillStatTotal(dto);
        return R.data(data);
    }

    @GetMapping("/shipImpBillStatPage")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "进口船统计分页", notes = "传入dto")
    public R<IPage<ImpShipBillStatVO>> shipImpBillStatPage(TShipBillStatusSearchDTO dto, Query query) {
        IPage<ImpShipBillStatVO> page = service.shipImpBillStatPage(Condition.getPage(query), dto);
        return R.data(page);
    }

    @GetMapping("/shipImpBillStatTotal")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "出口船统计合计", notes = "传入dto")
    public R<ImpShipBillStatTotalVO> shipImpBillStatTotal(TShipBillStatusSearchDTO dto) {
        ImpShipBillStatTotalVO data = service.shipImpBillStatTotal(dto);
        return R.data(data);
    }

    @PostMapping("/updateStatus")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "更新", notes = "传入主键ID")
    public R<TShipBillStatus> update(@RequestBody TShipBillStatus entity) {
        return R.data(service.updateStatus(entity));
    }

    @GetMapping("/shipStatTallyPage")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "船统计理货分页", notes = "传入dto")
    public R<IPage<ShipStatTallyVO>> shipStatTallyPage(TShipBillStatusSearchDTO dto, Query query) {
        IPage<ShipStatTallyVO> page = service.shipStatTallyPage(Condition.getPage(query), dto);
        return R.data(page);
    }

}
